package com.huawei.appmarket.service.usercenter.personal.view.card;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.hms.support.api.client.Result;
import com.huawei.hms.support.api.sns.UserUnreadMsgCountResult;
import java.lang.ref.WeakReference;
import o.cdb;
import o.cgz;
import o.der.e;
import o.der.f;
import o.Logger;
import o.eke;
import o.ekn;
import o.ekt;
import o.ekw;

public class BasePersonalMsgImgCard extends ekw {
    private int ˏ = 0;

    static final class c implements ekn {
        private WeakReference<BasePersonalMsgImgCard> ˊ;

        c(BasePersonalMsgImgCard basePersonalMsgImgCard) {
            this.ˊ = new WeakReference(basePersonalMsgImgCard);
        }

        public void ˏ(Result result) {
            if (this.ˊ != null) {
                BasePersonalMsgImgCard basePersonalMsgImgCard = (BasePersonalMsgImgCard) this.ˊ.get();
                if (basePersonalMsgImgCard != null && (result instanceof UserUnreadMsgCountResult)) {
                    UserUnreadMsgCountResult userUnreadMsgCountResult = (UserUnreadMsgCountResult) result;
                    Logger.ˏ("BasePersonalMsgImgCard", "UserUnreadMsgCountResult, resp.count: " + userUnreadMsgCountResult.getCount());
                    basePersonalMsgImgCard.ˊ(userUnreadMsgCountResult.getCount());
                }
            }
        }
    }

    public BasePersonalMsgImgCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        super.ˏ(view);
        ˏ(this.ॱ, e.ˊ);
        this.ˎ.setText(f.ᶥॱ);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (ekt.ˎ()) {
            ((eke) cdb.ॱ(eke.class)).ˏ(new c(this));
            return;
        }
        this.ˏ = 0;
        ˎ(0);
    }

    private void ˊ(int i) {
        if (this.ˏ != i) {
            this.ˏ = i;
            ˎ(i);
        }
    }

    public void onClick(View view) {
        this.ˏ = 0;
        ˎ(0);
        ˊ();
        ˋ();
    }

    protected void ˊ() {
        if (this.ˊ == null || !(this.ˊ instanceof Activity)) {
            Logger.e("BasePersonalMsgImgCard", " context is not instance of Activity");
        } else {
            ((eke) cdb.ॱ(eke.class)).ˏ((Activity) this.ˊ);
        }
    }
}
